home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln0586.arc
/
ALICE.LTG
< prev
next >
Wrap
Text File
|
1986-04-06
|
2KB
|
96 lines
Listing 1
-
program LetsPlayFindTheBug(input, output);
type
String = packed array [1..80] of char;
var
InputLine : String;
procedure FlushRight(var Line: String; Width: integer);
var
Temp : String;
begin
Pad(Line, Width);
while Line[Width] <= ' ' do begin
Temp := Line;
Line := " ";
StrConcat(Line, Temp);
SubStr(Line, Width, 1, Line);
end;
end;
procedure Pad(var Line: String; Width: integer);
{Declarations}
begin
while StrLen(Line) < Width do begin
StrConcat(Line, " ");
end;
SubStr(Line, Width, 1, Line);
end;
begin
repeat
readln(InputLine);
FlushRight(InputLine, 30);
writeln(InputLine);
until InputLine = "";
writeln("Thank you for useing Alice");
end.
-
- Listing 2
-
program TheCaseOfTheMissingLine(input, output);
function Factorial(I: integer) : integer;
var
Result : integer;
begin
if I >= 2 then begin
Result := I*Factorial(I - 1);è end
else begin
Result := 1;
end;
end;
begin
writeln(Factorial(7));
end.
-
- Listing 3
-
program CaseInPoint;
type
Groceries = ^Grocery;
Grocery = record
Brand : packed array [1..20] of char;
Quantity : integer;
Next : Groceries;
end;
var
GroceryList, Food : Groceries;
begin
new(Food);
with Food^ do
repeat
write("What do you want? ");
readln(Brand);
if Brand <> "" then begin
write("How much do you want? ");
readln(Quantity);
Next := Groceries;
Groceries := Food;
end;
until Brand = "";
dispose(Food);
Food := Groceries;
while Food <> nil do
with Food^ do
writeln(Quantity:5, " ", Brand);
end.